<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>06_substring</title>
</head>

<body>
  <script>
    /**
     * substring()
     * 语法: 字符串.substring(开始索引, 结束索引)
     * 作用: 截取字符串
     * 返回值: 截取出来的字符串
     * 特点: 包前不包后
    */

    var str = 'hello world';
    console.log('原始字符串:', str);

    // 从 【2】开始往后截取到【8】,不好含【8】
    var result = str.substring(2,8);
    console.log('截取后的字符串:', result);
  </script>
</body>

</html>
